package com.csk.zsk.compents.service.impl;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.csk.zsk.compents.dao.BookResourceDao;
import com.csk.zsk.compents.dao.ComicResourceDao;
import com.csk.zsk.compents.dao.MusicResourceDao;
import com.csk.zsk.compents.dao.NewsResourceDao;
import com.csk.zsk.compents.dao.PicnewsResourceDao;
import com.csk.zsk.compents.dao.VideoResourceDao;
import com.csk.zsk.compents.entity.BookResource;
import com.csk.zsk.compents.entity.ComicResource;
import com.csk.zsk.compents.entity.MusicResource;
import com.csk.zsk.compents.entity.NewsResource;
import com.csk.zsk.compents.entity.PicnewsResource;
import com.csk.zsk.compents.entity.VideoResource;
import com.csk.zsk.compents.service.ResourceService;

@Service
@Transactional
public class ResourceServiceImpl implements ResourceService {

	@Autowired
	private BookResourceDao bookResourceDao;
	@Autowired
	private ComicResourceDao comicResourceDao;
	@Autowired
	private MusicResourceDao musicResourceDao;
	@Autowired
	private PicnewsResourceDao picnewsResourceDao;
	@Autowired
	private VideoResourceDao videoResourceDao;
	@Autowired
	private NewsResourceDao newsResourceDao;

	@Override
	public void saveBookResource(BookResource bookResource) {
		bookResourceDao.save(bookResource);
	}

	@Override
	public void saveComicResource(ComicResource comicResource) {
		comicResourceDao.save(comicResource);
	}

	@Override
	public void saveMusicResource(MusicResource musicResource) {
		musicResourceDao.save(musicResource);
	}

	@Override
	public void saveNewsResource(NewsResource newsResource) {
		newsResourceDao.save(newsResource);
	}

	@Override
	public void savePicnewsResource(PicnewsResource picnewsResource) {
		picnewsResourceDao.save(picnewsResource);
	}

	@Override
	public void saveVideoResource(VideoResource videoResource) {
		videoResourceDao.save(videoResource);
	}

	@Override
	public void deleteBookResource(String id) {
		bookResourceDao.delete(id);
	}

	@Override
	public void deleteComicResource(String id) {
		comicResourceDao.delete(id);
	}

	@Override
	public void deleteMusicResource(String id) {
		musicResourceDao.delete(id);
	}

	@Override
	public void deleteNewsResource(String id) {
		newsResourceDao.delete(id);
	}

	@Override
	public void deletePicnewsResource(String id) {
		picnewsResourceDao.delete(id);
	}

	@Override
	public void deleteVideoResource(String id) {
		videoResourceDao.delete(id);
	}

	@Override
	@Transactional(readOnly = true)
	public BookResource getBookResource(String id) {
		return bookResourceDao.get(id);
	}

	@Override
	@Transactional(readOnly = true)
	public ComicResource getComicResource(String id) {
		return comicResourceDao.get(id);
	}

	@Override
	@Transactional(readOnly = true)
	public MusicResource getMusicResource(String id) {
		return musicResourceDao.get(id);
	}

	@Override
	@Transactional(readOnly = true)
	public NewsResource getNewsResource(String id) {
		return newsResourceDao.get(id);
	}

	@Override
	@Transactional(readOnly = true)
	public PicnewsResource getPicnewsResource(String id) {
		return picnewsResourceDao.get(id);
	}

	@Override
	@Transactional(readOnly = true)
	public VideoResource getVideoResource(String id) {
		return videoResourceDao.get(id);
	}

	@Override
	@Transactional(readOnly = true)
	public List<BookResource> searchBookResource(String title, String userName, Date startDate, Date endDate) {
		return bookResourceDao.searchBookResource(title, userName, startDate, endDate);
	}

	@Override
	@Transactional(readOnly = true)
	public List<ComicResource> searchComicResource(String title, String userName, Date startDate, Date endDate) {
		return comicResourceDao.searchComicResource(title, userName, startDate, endDate);
	}

	@Override
	@Transactional(readOnly = true)
	public List<MusicResource> searchMusicResource(String title, String userName, Date startDate, Date endDate) {
		return musicResourceDao.searchMusicResource(title, userName, startDate, endDate);
	}

	@Override
	@Transactional(readOnly = true)
	public List<NewsResource> searchNewsResource(String title, String userName, Date startDate, Date endDate) {
		return newsResourceDao.searchNewsResource(title, userName, startDate, endDate);
	}

	@Override
	@Transactional(readOnly = true)
	public List<PicnewsResource> searchPicnewsResource(String title, String userName, Date startDate, Date endDate) {
		return picnewsResourceDao.searchPicnewsResource(title, userName, startDate, endDate);
	}

	@Override
	@Transactional(readOnly = true)
	public List<VideoResource> searchVideoResource(String title, String userName, Date startDate, Date endDate) {
		return videoResourceDao.searchVideoResource(title, userName, startDate, endDate);
	}

	@Override
	@Transactional(readOnly = true)
	public List<BookResource> getBookResources(String userId, Integer num) {
		return bookResourceDao.getBookResources(userId, num);
	}

	@Override
	@Transactional(readOnly = true)
	public List<ComicResource> getComicResources(String userId, Integer num) {
		return comicResourceDao.getComicResources(userId, num);
	}

	@Override
	@Transactional(readOnly = true)
	public List<MusicResource> getMusicResources(String userId, Integer num) {
		return musicResourceDao.getMusicResources(userId, num);
	}

	@Override
	@Transactional(readOnly = true)
	public List<NewsResource> getNewsResources(String userId, Integer num) {
		return newsResourceDao.getNewsResources(userId, num);
	}

	@Override
	@Transactional(readOnly = true)
	public List<PicnewsResource> getPicnewsResources(String userId, Integer num) {
		return picnewsResourceDao.getPicnewsResources(userId, num);
	}

	@Override
	@Transactional(readOnly = true)
	public List<VideoResource> getVideoResources(String userId, Integer num) {
		return videoResourceDao.getVideoResources(userId, num);
	}
}
